<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE body PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="plug-in/smartMenu/css/smartMenu.css" type="text/css" />
<script src="plug-in/smartMenu/js/jquery-1.8.3.min.js"></script>
<script src="plug-in/smartMenu/js/jquery-smartMenu.js"></script>
</head>
<body>
	输入值：
  <div id="editP" region="center" style="padding:1px;background-color: gray;" >
  	
  </div>
 </body>
</html>

 <script>
 var createDiv = function(dom){
	 return "<div >"+dom+"<span onclick='closeDiv(this)'>关闭</span></div>";
 }
 var closeDiv = function(obj){
	 $(obj).parent().remove();
 }
 var createSelect = function(){
	 return "<select></select>";
 }
 var imageMenuData = [
 	[{
 		text: "在前面插入",
 		data: [[{
 			text: "规则",
 			func: function() {
 				$(this).before("<select><option value=\"(\">(</option><option value=\"==\">=</option><option value=\")\">)</option></select>");
 			}
 		}, {
 			text: "属性",
 			func: function() {
 				$(this).before("<select><option value=\"regTime\">注册时间</option><option value=\"source\">数据来源</option></select>");
 			}
 		}]]
 	}, {
 		text: "在后面插入",
 		data: [[{
 			text: "规则",
 			func: function() {
 				$(this).after("<select><option value=\"(\">(</option><option value=\"==\">=</option><option value=\")\">)</option></select>");
 			}
 		}, {
 			text: "属性",
 			func: function() {
 				$(this).after("<select><option value=\"regTime\">注册时间</option><option value=\"source\">数据来源</option></select>");
 			}
 		}]]
 	}, {
 		text: "删除",
 		func: function() {
 			$(this).remove();
 		}
 	}, {
 		text: "编辑",
 		func: function() {
 			$(this).on("click", function(){
 				alert("暂不支持");
 			});
 		}
 	}]
 ];
 
 
 
 var bodyMenuData = [[
                      { 
                    	  text: "插入元素" ,
                    	  func: function() {
                    		  $(this).before(createDiv(createSelect()));
                   		}
 
 }]];
	 	$("#editP").smartMenu(imageMenuData, {
		 	name: "image"	
		 });
		 $("body").smartMenu(bodyMenuData, {
		 	name: "body"	
		 });
 </script>